home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993 October: Windmill on DISC / ADC Developer CD (1993-10) (''Windmill On DISC'')_iso / Dev.CD Oct 93.iso / Utilities / Installer v3.4.3 / Examples - Installer 3.4 / InstallDA.r < prev    next >
Encoding:
Text File  |  1993-06-15  |  8.4 KB  |  227 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2.  *
  3.  *    Apple Macintosh Developer Technical Support
  4.  *
  5.  *  Installer 3.2 sample: installing a desk accessory into the appropriate place
  6.  *
  7.  *    File:        InstallDA.r -    Rez Source
  8.  *
  9.  *  Modifications:
  10.  *        5/19/93: RRK Changed Target file spec typeCrMustMatch flag setting to
  11.  *                        typeCrMustMatch and included comment that this will
  12.  *                        allow the replacement of the target file if for some reason
  13.  *                        the file or creator are different.
  14.  *                     Used InstallerCommon.r defines.
  15.  *
  16.  *    by:            Jon Zap
  17.  *  updated for use with Installer 3.4 by: Rich Kubota 9/1/92
  18.  *
  19.  *    Copyright © 1991 Apple Computer, Inc.
  20.  *    All rights reserved.
  21.  *
  22.  *------------------------------------------------------------------------------
  23.  * This sample installs the Key Caps DA into the appropriate place: the system file if we
  24.  * are pre 7.0 or into the Apple Menu Items folder if we are 7.0 or later.
  25.  * It allows for custom installation/removal.
  26.  * We use the gestalt findfolder attributes to determine whether or not the Apple
  27.  * Menu Items folder exists (assuming that there is a correlation between this
  28.  * trap and the folder).  The custom installation makes this difference explicit.
  29.  * Notes of interest:  if we are installing a DA into the system file (pre 7.0)
  30.  * then we merely use an 'inra' that specifies the 'DRVR' resource in a suitcase
  31.  * file by name, the DA's owned resources are handled by the installer
  32.  *----------------------------------------------------------------------------*/
  33.  
  34. #include "Types.r"                    /* for the ICON resource */
  35. #include "InstallerTypes.r"
  36. #include "InstallerCommon.r"        /* list of macros to simplify list */
  37.  
  38. /* You can build and complete the script with the following lines:
  39. # Note: set up floppies with the appropriate names and contents before running scriptcheck
  40. # or set up folders with the same names and contents as the floppies
  41. # put these folders in the same folder as the script or at the root directory of same disk
  42.  
  43.     rez -o "InstallDA" -t 'bbkr' -c 'bbkr' "InstallDA.r"
  44.     setfile -a i "InstallDA"        #mark Inited
  45.     scriptcheck -p "InstallDA"
  46. */
  47.  
  48. /* Definitions for the rules */
  49. #define rule7                1000
  50. #define rule6                1001
  51.  
  52. /* Defines for the file spec atoms.  These are specifications for source and destination files */
  53. #define fsSourceDA7            2000
  54. #define fsSourceDA6            2001
  55. #define fsTargetDA7            2002
  56. #define fsTargetSystem        2003
  57.  
  58. /* This is the name of the source disk */
  59. #define DADisk "DA Disk:"
  60.  
  61. /* where we want to install our DA. */
  62. #define TargetPath7    "special-amnu:"
  63. #define TargetPath6 "special-macs:"
  64.  
  65. /* Definition for the package. */
  66. #define pkTheDA7            3000
  67. #define pkTheDA6            3001
  68.  
  69. /* Definition for the file atom */
  70. #define faDA7                4000
  71.  
  72. /* definition for the resource atom */
  73. #define raDA6                5000
  74.  
  75. /* Definition for the package comment resource */
  76. #define cmtTheDA            6000
  77. #define iconTheDA            7000
  78.  
  79. /* May 19, 1993 is the current release date I put in 'icmt' rsrcs. ScriptCheck will convert */
  80. /* this value to a LongInt seconds value needed by the Installer. */
  81. #define currentReleaseDate        5191993    
  82. #define currentVersion            102     /* Version 1.0.2 goes in the 'icmt' rsrc */
  83.  
  84. /* Gestalt definitions taken from the Gestalt.h file for use in the CheckGestalt clause */
  85. #define gestaltFindFolderAttr 'fold'        /* Folder Mgr attributes */
  86.  
  87.  
  88. /************************** Easy Install Rule resources **********************************/
  89. resource 'infr' (1) {
  90.     format0  {{
  91.         pickFirst,    {rule7, rule6},     /* Select the first rule */
  92.     }};
  93. };
  94.  
  95. /* note the '.' in the first rule is missing in the 2nd rule so we can differentiate*/
  96. resource 'inrl' (rule7) {
  97.     format0 {{
  98.         checkGestalt { gestaltFindFolderAttr, {1} },
  99.         addUserDescription {"Click Install button to install\n"}, /* message to appear in Easy Install screen */
  100.         addUserDescription {"• Key Caps(System 7.0)\n"},
  101.         addPackages {{pkTheDA7}}            /* we're installing the DA */
  102.     }};
  103. };
  104. resource 'inrl' (rule6) {
  105.     format0 {{
  106.         addUserDescription {"Click Install button to install\n"}, /* message to appear in Easy Install screen */
  107.         addUserDescription {"• Key Caps(System 6.0)\n"},    /* message to appear in Easy Install screen */
  108.         addPackages {{pkTheDA6}}            /* we're installing the DA */
  109.     }};
  110. };
  111.  
  112. /***************************** Package Resources ************************************************/
  113. resource 'inpk' (pkTheDA7) {
  114.     format0 {
  115.         showsOnCustom,                     /* Package appears in the Custom Install display */
  116.         removable,                        /* Package can be removed */
  117.         dontForceRestart,                /* not necessary to reboot in this case */
  118.         cmtTheDA,                         /* package's 'icmt' resource id */
  119.         0,                                /* Package size (filled in by ScriptCheck) */
  120.         "DA -> Apple Menu folder (System 7.0)", { /* package name for package that shows on custom */
  121.             'infa', faDA7;
  122.         }
  123.     }
  124. };
  125.  
  126. resource 'inpk' (pkTheDA6) {
  127.     format0 {
  128.         showsOnCustom,                 /* Package appears in the Custom Install display */
  129.         removable,                    /* Package can be removed */
  130.         forceRestart,                /* major mod to system file, force reboot on live install */
  131.         cmtTheDA,                     /* package's 'icmt' resource id */
  132.         0,                            /* Package size (filled in by ScriptCheck) */
  133.         "Key Caps DA -> system file (Pre System 7.0)", { /* package name for package that shows on custom */
  134.             'inra', raDA6;
  135.         }
  136.     }
  137. };
  138.  
  139. /***************************** Comments ************************************************/
  140. resource 'icmt' (cmtTheDA) {
  141.     currentReleaseDate,
  142.     currentVersion,
  143.     iconTheDA,
  144.     "This package installs the Key Caps DA. "
  145. };
  146.  
  147. resource 'ICON' (iconTheDA) {
  148.         $"0430 4000 0A50 A000 0B91 1002 0822 0803"
  149.         $"1224 0405 2028 0209 4010 0111 800C 00A1"
  150.         $"8003 FFC2 7E00 FF04 0100 7F04 0300 1E08"
  151.         $"04E0 000C 08E0 000A 10E0 0009 08C0 0006"
  152.         $"0487 FE04 0288 0104 0188 0084 0088 0044"
  153.         $"0088 0044 0088 00C4 0110 0188 0228 0310"
  154.         $"01C4 04E0 0002 0800 73BF FBEE 4CA2 8A2A"
  155.         $"40AA AAEA 52AA AA24 5EA2 8AEA 73BE FB8E",
  156. };
  157.  
  158.  
  159.  
  160. /********************************************* File Specs *******************************************/
  161. /* Source File Specs */
  162. resource 'infs' (fsSourceDA7) {
  163.     'dfil',                                /* File Type */
  164.     'keyc',                                /* Creator */
  165.     kScriptCheckSetsDate,                /* ScriptCheck fills in the creation date */
  166.     noSearchForFile,                    /* Do not search the source disk for the file */
  167.     typeCrMustMatch,                    /* file type and creator on source disk must match */
  168.     DADisk"Key Caps 7.0"                /* Path to the file */
  169. };
  170.  
  171. resource 'infs' (fsSourceDA6) {
  172.     'DFIL',                                /* File Type */
  173.     'DMOV',                                /* Creator */
  174.     kScriptCheckSetsDate,                /* ScriptCheck fills in the creation date */
  175.     noSearchForFile,                    /* Do not search the source disk for the file */
  176.     typeCrMustMatch,                    /* file type and creator on source disk must match */
  177.     DADisk"Key Caps 6.0"                    /* Path to the file */
  178. };
  179.  
  180. /* Target File Specs */
  181. resource 'infs' (fsTargetDA7) {
  182.     'dfil',                                /* File Type */
  183.     'keyc',                                /* Creator */
  184.     kNoDateStampCheck,                    /* creation date must be zero for target file spec */
  185.     noSearchForFile,                    /* Do not search the target disk for the file */
  186.     typeCrNeedNotMatch,                    /* file to be replaced even if F&C don't match  */
  187.     TargetPath7"Key Caps"                /* destination Path */
  188. };
  189.  
  190. resource 'infs' (fsTargetSystem) {
  191.     'ZSYS',                                /* File Type */
  192.     'MACS',                                /* Creator */
  193.     kNoDateStampCheck,                    /* creation date must be zero for target file spec */
  194.     noSearchForFile,                    /* Do not search the target disk for the file */
  195.     typeCrNeedNotMatch,                    /* file to be found by name even if F&C don't match  */
  196.     TargetPath6"System"                    /* destination Path */
  197. };
  198.  
  199. /******************************************** File Atoms ************************************************/
  200. resource 'infa' (faDA7) {
  201.     format0 {
  202.         StdRemLeaveNewerCopy,            /* see InstallerCommon.r */
  203.         fsTargetDA7,                    /* TARGET file spec for this file */
  204.         fsSourceDA7,                     /* SOURCE file spec for this file */
  205.         0,                                /* atom size (filled in by ScriptCheck) */
  206.         ""                                /* Atom Description (Installer will use file name) */
  207.     };
  208. };
  209.  
  210. /******************************************** Resource Atoms **********************************************/
  211. resource 'inra' (raDA6) {
  212.     format0 {
  213.         StdRemResCopyName,                /* See InstallerCommon.r */
  214.         fsTargetSystem,                    /* Target file spec to install rsrc into */
  215.         fsSourceDA6,                    /* Source file spec where to get rsrc */
  216.         'DRVR',                            /* Resource type */
  217.         0,                                 /* Resource source id */
  218.         0,                                /* Resource target id */
  219.         0,                                /* atom size (filled in by ScriptCheck) */
  220.         "Desk Accessory: Key Caps",        /* Atom description */                            
  221.         "\0x00Key Caps"                    /* Resource name */
  222.     };
  223. };
  224.  
  225.  
  226.  
  227.